package com.ibiaoke.marketing.dao;

import com.ibiaoke.common.base.BaseDao;
import com.ibiaoke.marketing.entity.ShareUserRel;
import com.ibiaoke.marketing.entity.ShareUserRelExample;
import com.ibiaoke.marketing.mapper.ShareUserRelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class ShareUserRelDao extends BaseDao<ShareUserRel, ShareUserRelExample, Integer, ShareUserRelMapper> {

    @Autowired
    private ShareUserRelMapper shareUserRelMapper;

    @Override
    public ShareUserRelMapper getMapper() {
        return shareUserRelMapper;
    }

    public long countShareUserRel(Integer marketingId, Integer userId) {
        ShareUserRelExample example = new ShareUserRelExample();
        example.createCriteria().andMarketingIdEqualTo(marketingId).andUserIdEqualTo(userId);
        return countByExample(example);
    }

    public ShareUserRel getShareUserRel(Integer marketingId, Integer userId) {
        ShareUserRelExample example = new ShareUserRelExample();
        example.createCriteria().andMarketingIdEqualTo(marketingId).andUserIdEqualTo(userId);
        return getByExample(example);
    }
}
